﻿using System;
using UnityEngine;
using UnityEngine.UI;

[DisallowMultipleComponent, RequireComponent(typeof(Text))]
public class LocalizableText : MonoBehaviour
{
    public string id;
    private string initialText;
    private Text m_textComp;

    private void Awake()
    {
        this.initialText = this.text;
        this.Refresh();
    }

    public void Refresh()
    {
        this.text = Localization.GetText(this.id, this.initialText);
    }

    private void Reset()
    {
        this.id = base.transform.GetPathInHierarchy("_").Replace("_Text", string.Empty);
    }

    public string text
    {
        get
        {
            return this.textComp.text;
        }
        set
        {
            this.textComp.text = value;
        }
    }

    public Text textComp
    {
        get
        {
            if (this.m_textComp == null)
            {
            }
            return (this.m_textComp = base.GetComponent<Text>());
        }
    }
}

